<html>
<head><meta charset="utf-8"><title>field_reassign_with_default · clippy · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/index.html">clippy</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/field_reassign_with_default.html">field_reassign_with_default</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="222095552"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/field_reassign_with_default/near/222095552" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> ThibsG <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/field_reassign_with_default.html#222095552">(Jan 08 2021 at 16:51)</a>:</h4>
<p>My  code triggered <code>field_reassign_with_default</code> lint, but it originated in Paperclip crate:</p>
<div class="codehilite"><pre><span></span><code>error: field assignment outside of initializer for an instance created with Default::default()
  |
4 | #[derive(Apiv2Schema, Serialize, Deserialize, Debug)]
  |          ^^^^^^^^^^^
  |
  = note: `-D clippy::field-reassign-with-default` implied by `-D warnings`
note: consider initializing the variable with `paperclip::v2::models::DefaultSchemaRaw { data_type: Apiv2Schema, ..Default::default() }` and removing relevant reassignments
  |
4 | #[derive(Apiv2Schema, Serialize, Deserialize, Debug)]
  |          ^^^^^^^^^^^
  = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#field_reassign_with_default
  = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
</code></pre></div>
<p>As my code is mainly REST server, it is triggering in a lot of places.<br>
Just wondering if this is expected behavior or if we maybe should skip linting on external macros?</p>



<a name="222095769"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/field_reassign_with_default/near/222095769" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> flip1995 <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/field_reassign_with_default.html#222095769">(Jan 08 2021 at 16:52)</a>:</h4>
<p>IIRC <span class="user-mention" data-user-id="197894">@Philipp Hansch</span> fixed this recently?</p>



<a name="222095951"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/field_reassign_with_default/near/222095951" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> ThibsG <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/field_reassign_with_default.html#222095951">(Jan 08 2021 at 16:54)</a>:</h4>
<p>ah yeah here: <a href="https://github.com/rust-lang/rust-clippy/issues/6545">https://github.com/rust-lang/rust-clippy/issues/6545</a></p>



<a name="222096118"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/field_reassign_with_default/near/222096118" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> ThibsG <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/field_reassign_with_default.html#222096118">(Jan 08 2021 at 16:55)</a>:</h4>
<p>sorry, all good then, just need to remember to remove <code>is:open</code> when finding issues ^^</p>



<a name="222096131"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/field_reassign_with_default/near/222096131" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> ThibsG <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/field_reassign_with_default.html#222096131">(Jan 08 2021 at 16:55)</a>:</h4>
<p>thanks!</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>